using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
	public partial class ShippingAddressMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<ShippingAddress> {
		public ShippingAddressMap() {
			// table
			ToTable("mc_ShippingAddress", "dbo");

			// keys
			HasKey(t => t.Id);

            // Properties
            Property(t => t.Address)
                .HasColumnName("Address")
                .HasMaxLength(100)
                .IsRequired();
            Property(t => t.CardNegative)
                  .HasColumnName("CardNegative")
                  .IsRequired();
			Property(t=>t.MerchantId)
				.HasColumnName("MerchantId")
				.IsOptional();
            Property(t => t.CardPositive)
                .HasColumnName("CardPositive")
                .IsRequired();

            Property(t => t.RealName)
                .HasColumnName("RealName")
                .IsRequired();
            Property(t => t.Phone)
				.HasColumnName("Phone")
				.HasMaxLength(20)
				.IsRequired();
			Property(t => t.RegionId)
				.HasColumnName("RegionId")
				.IsRequired();
			Property(t => t.IdCard)
				.HasColumnName("IdCard")
				.HasMaxLength(30)
				.IsRequired();
            Property(t => t.ShipTo)
                .HasColumnName("ShipTo")
                .HasMaxLength(100)
                .IsRequired();
            Property(t => t.IsDefault)
				.HasColumnName("IsDefault")
		    	.IsRequired();
            HasRequired(t => t.Region)
              .WithMany()
              .HasForeignKey(d => d.RegionId)
              .WillCascadeOnDelete(false);
        }
	}
}
